﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Data;
public class ChartPanel : MonoBehaviour
{
    public InputField input;
    public Text chatText;
    public Button sendBtn;
   
    void Start()
    {
        sendBtn.onClick.AddListener(OnSendClick);
    }
    void OnSendClick()
    {
        //string msg = input.text;
        Chat chat = new Chat();
        chat.msg = input.text;

        NetworkManager.Instance.Send(Protocal.Chat_CMD, ProtoHelper.Serialize(chat));
    }
    //所有unity的游戏对象 ui等 只能在主线程使用
    //void OnChart(string message)
    //{
    //    chatText.text += message + "\r\n";
    //}

    void OnChart(Chat chat)
    {
        chatText.text += chat.msg + "\r\n";
    }
}
